package cn.springcloud.fix.common.log;

import cn.springcloud.fix.common.log.aspect.AsyncLogAspect;
import cn.springcloud.fix.common.log.condition.EnableAsyncLogCondition;
import cn.springcloud.fix.common.log.listener.LogEventListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

@EnableAsync
@Configuration
@Conditional(EnableAsyncLogCondition.class)
public class AsyncLogAutoConfig {

    @Bean
    public LogEventListener logEventListener() {
        return new LogEventListener();
    }

    @Bean
    public AsyncLogAspect logAspect() {
        return new AsyncLogAspect();
    }
}
